package com.yuanqi.springboot_banksystem.utils;

import org.springframework.util.DigestUtils;

import java.util.UUID;

public class MD5Util {

    public static String getMd5Password(String password, String salt){
        for (int i = 0; i < 3; i++) {
            password = DigestUtils.md5DigestAsHex((salt + password + salt).getBytes()).toUpperCase();

        }
        return password;
    }

    public static String getRandomSalt(){
        return UUID.randomUUID().toString().toUpperCase();
    }

}
